package com.rc.evcharger.redis;

import java.io.Serializable;
import java.math.BigDecimal;

public class RedPile implements Serializable {
    public static final String PILE = "pile";
    private static final long serialVersionUID = -991312078502012737L;

    public String rtua;

    public String gunNum;

    public BigDecimal volt;

    public BigDecimal elec;

    public BigDecimal power;

    public RedPile() {
        super();
    }

    public RedPile(String rtua, String gunNum, BigDecimal volt, BigDecimal elec, BigDecimal power) {
        super();
        this.rtua = rtua;
        this.gunNum = gunNum;
        this.volt = volt;
        this.elec = elec;
        this.power = power;
    }

    public RedPile(String pileStr) {
        super();
        String[] strs = pileStr.split(",");
        this.rtua = strs[0];
        this.gunNum = strs[1];
        this.volt = new BigDecimal(strs[2]);
        this.elec = new BigDecimal(strs[3]);
        this.power = new BigDecimal(strs[4]);
    }

    public String getKey() {
        return this.getRtua() + ":" + this.getGunNum();
    }

    public String getRtua() {
        return rtua;
    }

    public void setRtua(String rtua) {
        this.rtua = rtua;
    }

    public String getGunNum() {
        return gunNum;
    }

    public void setGunNum(String gunNum) {
        this.gunNum = gunNum;
    }

    public BigDecimal getVolt() {
        return volt;
    }

    public void setVolt(BigDecimal volt) {
        this.volt = volt;
    }

    public BigDecimal getElec() {
        return elec;
    }

    public void setElec(BigDecimal elec) {
        this.elec = elec;
    }

    public BigDecimal getPower() {
        return power;
    }

    public void setPower(BigDecimal power) {
        this.power = power;
    }

    @Override
    public String toString() {
        StringBuffer sb = new StringBuffer();
        sb.append(this.rtua).append(",")
                .append(this.gunNum).append(",")
                .append(String.valueOf(this.volt)).append(",")
                .append(String.valueOf(this.elec)).append(",")
                .append(String.valueOf(this.power));
        return sb.toString();
    }

    public static void main(String[] args) {
        System.out.println(new BigDecimal(300).multiply(new BigDecimal(10)).divide(new BigDecimal(1000)));
    }
}
